package xndroid.util;

public class Pair {

	public final Object first;
	public final Object second;

	public Pair(Object first, Object second) {
		this.first = first;
		this.second = second;
	}

	public static Pair create(Object first, Object second) {
		return new Pair(first, second);
	}

	public boolean equals(Object object) {
		if (object != this) {
			if (!(object instanceof Pair)) {
				return false;
			}

			Pair pair;
			try {
				pair = (Pair) object;
			} catch (ClassCastException e) {
				return false;
			}

			if (!this.first.equals(pair.first) || !this.second.equals(pair.second)) {
				return false;
			}
		}

		return true;
	}

	public int hashCode() {
		return 31 * (527 + this.first.hashCode()) + this.second.hashCode();
	}
}
